package com.xxpt.common.exception;

import java.util.Map;
import java.util.TreeMap;

/**
 * 系统异常
 *
 * @Author masl - 2018/6/30 0030 18:02
 */
public class SystemException extends RuntimeException {
    private String message;
    private String code;
    private final Map<String, Object> properties = new TreeMap();

    public SystemException(String message) {
        super(message);
        this.message = message;
    }
    public SystemException set(String name, Object value) {
        this.properties.put(name, value);
        return this;
    }

    public SystemException(ErrorCode errorCode) {
        super(errorCode.getDesc());
        this.code = errorCode.getCode();
        this.message = errorCode.getDesc();
    }

    public SystemException(String code, String message) {
        super(message);
        this.code = code;
        this.message = message;
    }

    public String getCode() {
        return this.code;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }
}
